Attribute Type to function

Hello,

I am getting an null error when I passed attType to a function as an arguement. what I am doing wrong?

[code]


Object o = current
int iSeverity = 0
int iOccurrence = 0
string strSeverity = ""
string strOccurrence = ""
AttrType atSeverity = find(current Module, "Severity")
AttrType atOccurrence = find(current Module, "Occurrence")

 

int fnGetAttributeValue(AttrType atValue, string strValue)
{
   int i=0
   int iValue = 76
print atSeverity.strings[1] "\t"  atValue.size "\n" // Getting error here with atValue.size ********************************

   for(i = 0; i < atValue.size; i++) 
   {
      if(strValue == atValue.strings[i]"")
      {
         iValue = atValue.values[i]
         break
      }
   } 
   return iValue
}

for o in current Module do
{
   strSeverity = o."Severity"""
   strOccurrence = o."Occurrence"""
print atSeverity.strings[1] "\n"
   iSeverity  = fnGetAttributeValue(atSeverity , strSeverity)
   iOccurrence = fnGetAttributeValue(atOccurrence , strOccurrence)
   print (iSeverity * iOccurrence) "\n"
}

[code]

Thanks

Jester


jester76 - Tue Aug 06 17:43:36 EDT 2013

Re: Attribute Type to function
adevicq - Wed Aug 07 03:52:54 EDT 2013

Hi,

Probably a stupid question but did you check that the call to "find" returns something??

Alain

Re: Attribute Type to function
jester76 - Wed Aug 07 11:16:31 EDT 2013

adevicq - Wed Aug 07 03:52:54 EDT 2013

Hi,

Probably a stupid question but did you check that the call to "find" returns something??

Alain

It does. you can see that print finction prints (atSeverity.strings[1]) value for this.

Re: Attribute Type to function
adevicq - Wed Aug 07 11:47:14 EDT 2013

jester76 - Wed Aug 07 11:16:31 EDT 2013

It does. you can see that print finction prints (atSeverity.strings[1]) value for this.

Well, I tried this:

AttrType at = find (current Module, "Status")
print at.strings[2] "\n"
 
void f(AttrType x) {
print x.strings[1]
}
 
 
f(at)

and it works.

Try passing the parameter by address?

 

Re: Attribute Type to function
llandale - Thu Aug 08 14:48:05 EDT 2013

It would help if you copied the exact DXL error and any print output to date.

Guessing, try using parens:

  • print atSeverity.strings[1] "\t"  (atValue.size) "\n"

-Louie